﻿@using WB.Core.BoundedContexts.Designer.Resources
@using WB.Core.BoundedContexts.Designer.Views.Questionnaire.Pdf
@using WB.UI.Designer.Utils
@model Main.Core.Entities.SubEntities.IGroup
@{
    PdfQuestionnaireModel questionnaire = ViewBag.Questionnaire;
    var group = Model!;
}
<div class="group">
    <div class="group_container">
        <div class="breacrumbs">@questionnaire.GetBreadcrumbsForGroup(group.PublicKey)</div>
        <div class="sub_section" id="@questionnaire.GetItemRef(group.PublicKey)">@Html.Raw(questionnaire.GetGroupTitle(group))</div>
        <div class="generated_by">
            <div class="variable_name">@(group.VariableName)</div>
        </div>
        @if (questionnaire.GroupHasEnablementCondition(group))
        {
            <div class="common-info">
                <div class="condition">
                    <span>E</span>@questionnaire.GetExpressionExcerpt(group.ConditionExpression)
                    @if (questionnaire.ExpressionIsTooLong(group.ConditionExpression))
                    {
                        <div class="more">
                            <a href="#@questionnaire.GetConditionRef(group.PublicKey)">
                                @Pdf.Format(PdfStrings.AppendixLink, group.ConditionExpression.Length - questionnaire.Settings.ExpressionExcerptLength, questionnaire.GetEntityIndexInAppendix(group.PublicKey, "E"))
                            </a>
                        </div>
                    }
                </div>
            </div>
        }
    </div>
</div>
@await Html.PartialAsync("_RenderChildren", group.PublicKey)
<div class="group_footer"></div>
